﻿<Window x:Class="WpfAppLegoNXTCommSample.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="640" Width="1024">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="250"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Grid Grid.Column="0">
            <Border BorderBrush="Black" BorderThickness="2">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition Height="160" />
                    </Grid.RowDefinitions>
                    <Label Content="COM Port Connection" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                    <Label Content="COM Ports" Grid.Column="0" Grid.Row="2" VerticalAlignment="Center"/>
                    <Grid Grid.Column="1" Grid.Row="2">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="50"/>
                        </Grid.ColumnDefinitions>
                        <ComboBox Name="cbCOMPorts" Grid.Column="0" VerticalAlignment="Center" Margin="2,2,2,2"/>
                        <Button Name="buttonCOMPortReflesh" Content="Reflesh" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Click="buttonCOMPortReflesh_Click" />
                    </Grid>
                    <Label Content="Connection" Grid.Column="0" Grid.Row="1" VerticalAlignment="Center"/>
                    <Button Name="buttonConnect" Content="Connect" Grid.Column="1" Grid.Row="1" Margin="2,2,2,2" Click="buttonConnect_Click" ToolTip="下の項目を設定してクリック" />
                    <Label Content="Status" Grid.Column="0" Grid.Row="3"  VerticalAlignment="Center"/>
                    <TextBlock Name="tbStatus" Grid.Column="1" Grid.Row="3" VerticalAlignment="Center"/>
                    <Label Content="Baud Rate" Grid.Column="0" Grid.Row="4" VerticalAlignment="Center"/>
                    <TextBox Name="tbBaudRate" Grid.Column="1" Grid.Row="4" VerticalAlignment="Center" Margin="2,2,2,2"/>
                    <Label Content="Data Bit" Grid.Column="0" Grid.Row="5" VerticalAlignment="Center"/>
                    <TextBox Name="tbDataBit" Grid.Column="1" Grid.Row="5" VerticalAlignment="Center" Margin="2,2,2,2"/>
                    <Label Content="Parity" Grid.Column="0" Grid.Row="6" VerticalAlignment="Center"/>
                    <ComboBox Name="cbParity" Grid.Column="1" Grid.Row="6" VerticalAlignment="Center" Margin="2,2,2,2">
                        <ComboBoxItem Content="Even" />
                        <ComboBoxItem Content="Mark" />
                        <ComboBoxItem Content="None" IsSelected="True" />
                        <ComboBoxItem Content="Odd" />
                        <ComboBoxItem Content="Space" />
                    </ComboBox>
                    <Label Content="Stop Bit" Grid.Column="0" Grid.Row="7" VerticalAlignment="Center"/>
                    <ComboBox Name="cbStopBit" Grid.Column="1" Grid.Row="7" VerticalAlignment="Center" Margin="2,2,2,2" >
                        <ComboBoxItem Content="None"/>
                        <ComboBoxItem Content="One" IsSelected="True"/>
                        <ComboBoxItem Content="OnePointFive"/>
                        <ComboBoxItem Content="Two"/>
                    </ComboBox>
                    <Label Content="Flow Control" Grid.Column="0" Grid.Row="8" VerticalAlignment="Center"/>
                    <ComboBox Name="cbFlowControl" Grid.Column="1" Grid.Row="8" VerticalAlignment="Center" Margin="2,2,2,2">
                        <ComboBoxItem Content="None" IsSelected="True"/>
                        <ComboBoxItem Content="RequestToSend"/>
                        <ComboBoxItem Content="RequestToSendXOnXOff"/>
                        <ComboBoxItem Content="XOnXOff"/>
                    </ComboBox>
                    <Label Content="Encoding" Grid.Column="0" Grid.Row="9" VerticalAlignment="Center"/>
                    <ComboBox Name="cbEncoding" Grid.Column="1" Grid.Row="9" VerticalAlignment="Center">
                        <ComboBoxItem Content="ASCII" IsSelected="True"/>
                        <ComboBoxItem Content="HEX" />
                    </ComboBox>
                    <Border Grid.Column="0" Grid.Row="10" Grid.ColumnSpan="2" BorderBrush="Black" Margin="5,5,5,5" BorderThickness="2">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
                            <Button Name="buttonETRoboConSetting" Content="ET RoboCon Setting" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="0" Margin="5,5,5,5" Click="buttonETRoboConSetting_Click" />
                            <Button Name="buttonETRoboConDrive" Content="DRIVE" Grid.Column="0" Grid.Row="1" Margin="5,5,5,5" Click="buttonETRoboConDrive_Click" IsEnabled="False" />
                            <TextBlock Name="tbETRoboConDriveStatus" Grid.Column="1" Grid.Row="1" Margin="5,5,5,5" />
                            <Button Name="buttonETRoboConStop" Content="STOP" Grid.Column="0" Grid.Row="2" Margin="5,5,5,5" Click="buttonETRoboConStop_Click" IsEnabled="False"/>
                            <TextBlock Name="tbETRoboConStopStatus" Grid.Column="1" Grid.Row="2" Margin="5,5,5,5" />
                        </Grid>
                    </Border>
                </Grid>
            </Border>
        </Grid>
        <Grid Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Border Grid.Row="0" BorderBrush="Black" BorderThickness="2" >
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="50"/>
                        <RowDefinition Height="30"/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="150"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Button Name="buttonSend" Content="Send" Grid.Column="0" Grid.Row="0" Margin="2,2,2,2" Click="buttonSend_Click" ToolTip="右のテキストボックスに16進で送信データを記入してクリック" />
                    <TextBox Name="tbSendData" Grid.Column="1" Grid.Row="0" Margin="2,2,2,2" ToolTip="Please input hex data string here" />
                    <Label Content="Send Data History" Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center" />
                    <RichTextBox Name="rtbSendDataHistory" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" Margin="2,2,2,2" BorderBrush="Black" BorderThickness="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"/>
                </Grid>
            </Border>
            <Border Grid.Row="1" BorderBrush="Black" BorderThickness="2">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="30"/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="150"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Label Content="Received Data from Lego Mindstorms NXT" Grid.Row="0" Grid.ColumnSpan="2" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                    <RichTextBox Name="rtbReceivedData" Grid.Column="1" Grid.Row="1" Margin="2,2,2,2" BorderBrush="Black" BorderThickness="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"/>
                    <StackPanel Grid.Column="0" Grid.Row="1" Orientation="Vertical" Margin="2,2,2,2">
                        <CheckBox Name="cbShowRecivedDataRT" Content="Show Realtime" Margin="2,2,2,2"/>
                        <CheckBox Name="cbStoreComm" Content="Store Comm Log" Margin="2,2,2,2"/>
                        <Button Name="buttonClearReceivedData" Content="Clear Shown Data" Margin="2,2,2,2" Click="buttonClearReceivedData_Click" />
                        <Button Name="buttonShowStoredData" Content="Show Stored Data" Margin="2,2,2,2"/>
                        <CheckBox Name="cbShowStoredDataStepping" Content="Step" Margin="2,2,2,2" HorizontalAlignment="Right"/>
                        <Button Name="buttonExportReceiveData" Content="Export from DB" Margin="2,2,2,2"/>
                        <Button Name="buttonClearStoredData" Content="Clear Stored Data" Margin="2,2,2,2"/>
                    </StackPanel>
                </Grid>
            </Border>
        </Grid>
    </Grid>
</Window>
